//
//  HHUserService.h
//  InternetHospital
//
//  Created by chun.chen on 2022/2/14.
//  Copyright © 2022 HC. All rights reserved.
//  用户服务

#import <Foundation/Foundation.h>
#import <HHNetworkKit/HHNetworkKit.h>

#import "HHUserConfig.h"
#import "HHUserModel.h"
#import "HHUserIdentites.h"

NS_ASSUME_NONNULL_BEGIN

// 用户服务协议
@protocol HHUserServiceProtocol <NSObject>

@required

/// 手机密码登录
/// @param phoneNum 手机号
/// @param pwd 密码
/// @param completion completion description
- (void)userLogin:(NSString *)phoneNum password:(NSString *)pwd completion:(void(^ _Nullable)(BOOL success, HHUserIdentites * _Nullable identites) )completion;

/// 获取用户中心信息详情
/// @param completion completion description
- (void)getUserCenterInfoWithCompletion:(void (^)(HHUserModel * _Nullable userModel))completion;

- (void)sendSms:(NSString *)phoneNum actionType:(NSInteger)type completion:(void(^ _Nullable)(BOOL success) )completion;

- (void)userLogin:(NSString *)phoneNum verifyCode:(NSString *)code completion:(void(^ _Nullable)(BOOL success, HHUserIdentites * _Nullable identites) )completion;

@end

@interface HHUserService : NSObject <HHUserServiceProtocol>

/// 用户配置协议
@property (nonatomic, strong, readonly) HHUserConfig *config;


/// 更改用户配置协议
/// @param config config description
- (void)changeUserConfig:(NSObject<HHUserConfigProtocol> *)config;


/// 获取登陆key
/// @param phoneNum 手机号
/// @param completion completion description
- (void)fetchLoginKey:(NSString *)phoneNum completion:(void(^ _Nullable)(NSString *loginKey, NSString *doctorId) )completion;

/// 获取登录公钥
/// @param phoneNum 手机号
/// @param completion completion description
- (void)fetchUserPublicKey:(NSString *)phoneNum completion:(void(^ _Nullable)(NSString *publicKey) )completion;

/// 用户登录
/// @param params 入参
/// @param completion completion description
- (void)userLoginWithParams:(NSDictionary *)params completion:(void(^ _Nullable)(BOOL success, HHUserIdentites * _Nullable identites) )completion;

/// 登录环信
/// @param username 账号
/// @param password 密码
/// @param completion completion description
- (void)loginWithHuanxin:(NSString *)username password:(NSString *)password completion:(void (^)(BOOL success))completion;

- (void)fetchServiceTime:(void(^ _Nullable)(NSString *timeValue) )completion;

@end

NS_ASSUME_NONNULL_END
